<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <input type="hidden" name="storeid" value="{$storeid}" />
        <input type="hidden" name="id" value="{$item['id']}" />
        <div class="panel panel-default">
            <div class="panel-heading">
                商品编辑
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">人气值</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" name="subcount" value="{$item['subcount']}" />
                        <div class="help-block">人气值大于20时显示人气图标</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">商品名称</label>
                    <div class="col-sm-9">
                        <input type="text" name="goodsname" class="form-control" value="{$item['title']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">商品分类</label>
                    <div class="col-sm-9">
                        <select class="form-control" style="margin-right:15px;" name="pcate" onchange="fetchChildCategory(this.options[this.selectedIndex].value)"  autocomplete="off" class="form-control">
                            <option value="0">请选择分类</option>
                            {loop $category $row}
                            <option value="{$row['id']}" {if $row['id'] == $item['pcate']} selected="selected"{/if}>{$row['name']}</option>
                            {/loop}
                        </select>
                        <div class="help-block">
                            还没有分类，点我 <a href="{php echo $this->createWebUrl('category', array('op' => 'post', 'storeid' => $storeid))}"><i class="fa fa-plus-circle"></i> 添加分类</a>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打印标签</label>
                    <div class="col-sm-9">
                        <select class="form-control" style="margin-right:15px;" name="labelid"  autocomplete="off" class="form-control">
                            <option value="0">请选择标签</option>
                            {loop $label $row}
                            <option value="{$row['id']}" {if $row['id'] == $item['labelid']} selected="selected"{/if}>{$row['title']}</option>
                            {/loop}
                        </select>
                        <div class="help-block">
                            还没有标签，点我 <a href="{php echo $this->createWebUrl('printlabel', array('op' => 'post', 'storeid' => $storeid))}"><i class="fa fa-plus-circle"></i> 添加标签</a>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">商品图片</label>
                    <div class="col-sm-9">
                        {php echo tpl_form_field_image('thumb', $item['thumb'])}
                        <span class="help-block" style="color: #f00;">建议尺寸:300*300</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">价格</label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input type="text" name="marketprice" class="form-control" value="{$item['marketprice']}" />
                            <span class="input-group-addon">元</span>
                        </div>
                        <div class="help-block">必填</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">原价</label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input type="text" name="productprice" class="form-control" value="{$item['productprice']}" />
                            <span class="input-group-addon">元</span>
                        </div>
                        <div class="help-block"></div>
                    </div>
                </div>
                <!--<div class="form-group">-->
                <!--<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="require"> 启用规格</span></label>-->
                <!--<div class="col-sm-9 col-xs-12">-->
                <!--<label class="checkbox-inline"><input type="checkbox" name="is_options" value="1" {if $item['is_options'] == 1}checked{/if} onclick="$('#options').toggle();"> 启用</label>-->
                <!--<br>-->
                <!--<div id="options" {if $item['is_options']==1}style="display:block"{/if}>-->
                <!--<div class="tpl">-->
                <!--{if !empty($item['options'])}-->
                <!--{loop $item['options'] $row}-->
                <!--<div class="input-group">-->
                <!--<input type="hidden" name="options[id][]" value="{$row['id']}">-->
                <!--<span class="input-group-addon">规格名称</span>-->
                <!--<input type="text" name="options[name][]" value="{$row['name']}" class="form-control" placeholder="规格名称">-->
                <!--<span class="input-group-addon">价格</span>-->
                <!--<input type="text" name="options[price][]" value="{$row['price']}" class="form-control" placeholder="价格">-->
                <!--<span class="input-group-addon">库存</span>-->
                <!--<input type="text" name="options[total][]" value="{$row['total']}" class="form-control" placeholder="库存">-->
                <!--<span class="input-group-addon"><a href="javascript:;" class="delOptions"><i class="fa fa-times"></i></a></span>-->
                <!--</div>-->
                <!--{/loop}-->
                <!--{else}-->
                <!--<div class="input-group">-->
                <!--<input type="hidden" name="options[id][]" value="">-->
                <!--<span class="input-group-addon">规格名称</span>-->
                <!--<input type="text" name="options[name][]" class="form-control" placeholder="规格名称">-->
                <!--<span class="input-group-addon">价格</span>-->
                <!--<input type="text" name="options[price][]" class="form-control" placeholder="价格">-->
                <!--<span class="input-group-addon">库存</span>-->
                <!--<input type="text" name="options[total][]" class="form-control" placeholder="库存">-->
                <!--<span class="input-group-addon"><a href="javascript:;" class="delOptions"><i class="fa fa-times"></i></a></span>-->
                <!--</div>-->
                <!--{/if}-->
                <!--</div>-->
                <!--<a href="javascript:;" class="addOptions"><i class="fa fa-plus-circle"></i> 添加规格</a>-->
                <!--<span class="help-block">最多可添加5个规格. -1为库存无限制</span>-->
                <!--</div>-->
                <!--</div>-->
                <!--</div>-->
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">打包费</label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input type="text" name="packvalue" class="form-control" value="{$item['packvalue']}" />
                            <span class="input-group-addon">元</span>
                        </div>
                        <div class="help-block"></div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">每日库存</label>
                    <div class="col-sm-9">
                        <input type="text" name="counts" class="form-control" value="{$item['counts']}" />
                        <div class="help-block">-1表示不限制</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">今日已售</label>
                    <div class="col-sm-9">
                        <input type="text" name="today_counts" class="form-control" value="{$item['today_counts']}" />
                        <div class="help-block"></div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">总销量</label>
                    <div class="col-sm-9">
                        <input type="text" name="sales" class="form-control" value="{$item['sales']}" />
                        <div class="help-block"></div>
                    </div>
                </div>
                {if $_W['role'] != 'operator'}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">购买积分</label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input type="text" name="credit" class="form-control" value="{$item['credit']}" />
                            <span class="input-group-addon">分</span>
                        </div>
                        <div class="help-block">购买一份赠送多少积分，不赠送积分请填0。<code>注：只有订单完成后才赠送</code></div>
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">商品单位</label>
                    <div class="col-sm-9">
                        <input type="text" class="form-control" name="unitname" value="{if empty($item['unitname'])}份{else}{$item['unitname']}{/if}" />
                        <div class="help-block">份、例、斤、半斤、个 等</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">商品描述</label>
                    <div class="col-sm-9">
                        <textarea style="height:150px;" class="form-control richtext" name="description" cols="70">{$item['description']}</textarea>
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">口味</label>
                    <div class="col-sm-9">
                        <textarea style="height:50px;" class="form-control" name="taste" cols="70">{$item['taste']}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否上架</label>
                    <div class="col-sm-9">
                        <label for="isshow1" class="radio-inline"><input type="radio" name="status" value="1" id="isshow1" {if empty($item) || $item['status'] == 1}checked="true"{/if} /> 是</label>
                        &nbsp;&nbsp;&nbsp;
                        <label for="isshow2" class="radio-inline"><input type="radio" name="status" value="0" id="isshow2"  {if !empty($item) && $item['status'] == 0}checked="true"{/if} /> 否</label>
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                    <div class="col-sm-9">
                        <input type="text" name="displayorder" class="form-control" value="{$item['displayorder']}" />
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
<script type="text/javascript">
    <!--
    var category = {php echo json_encode($children)};
    //-->
</script>